package edu.univercidade.tcc.server.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;

import edu.univercidade.tcc.shared.model.EmailNotification;
import edu.univercidade.tcc.shared.model.MemberStatus;

@RooJavaBean
@RooToString
@RooEntity
public class ProjectMember {

	@Past
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "SS")
	private Date createdOn;

	@NotNull
	@NotBlank
	@Size(max = 30)
	private String firstname;

	@Column(name = "hashed_password", length=64)
	private String hashedPassword;

	@Column(name = "last_login_on")
	@Past
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "SS")
	private Date lastLoginOn;

	@NotNull
	@NotBlank
	@Size(max = 30)
	private String lastname;

	@NotNull
	@NotBlank
	@Size(max = 30)
	private String login;

	@NotNull
	@Size(max = 60)
	@Email
	private String mail;

	@NotNull
	@Enumerated(EnumType.ORDINAL)
	private MemberStatus status;

	@NotNull
	@Enumerated(EnumType.STRING)
	private EmailNotification mailNotification;

	@Override
	public String toString() {
		return mail;
	}
	
}
